using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.IO;

namespace PopLava.Tools
{
    [RunInstaller(true)]
    public partial class InstallerClass : Installer
    {
        public InstallerClass()
          : base()
        {
          // Attach the 'Committed' event.
          this.Committed += new InstallEventHandler(MyInstaller_Committed);
          // Attach the 'Committing' event.
          this.Committing += new InstallEventHandler(MyInstaller_Committing);
        }

        // Event handler for 'Committing' event.
        private void MyInstaller_Committing(object sender, InstallEventArgs e)
        {

        }

        // Event handler for 'Committed' event.
        private void MyInstaller_Committed(object sender, InstallEventArgs e)
        {
          try
          {
            Directory.SetCurrentDirectory(Path.GetDirectoryName
		    (Assembly.GetExecutingAssembly().Location));
            Process.Start(Path.GetDirectoryName(
              Assembly.GetExecutingAssembly().Location) + "\\WinClickPro.exe");
          }
          catch
          {
            // Do nothing... 
          }
        }

        // Override the 'Install' method.
        public override void Install(IDictionary savedState)
        {
          base.Install(savedState);
        }

        // Override the 'Commit' method.
        public override void Commit(IDictionary savedState)
        {
          base.Commit(savedState);
        }

        // Override the 'Rollback' method.
        public override void Rollback(IDictionary savedState)
        {
          base.Rollback(savedState);
        }
    }
}